/**
 * Copyright (c) 2000-2013 Liferay, Inc. All rights reserved.
 *
 * This library is free software; you can redistribute it and/or modify it under
 * the terms of the GNU Lesser General Public License as published by the Free
 * Software Foundation; either version 2.1 of the License, or (at your option)
 * any later version.
 *
 * This library is distributed in the hope that it will be useful, but WITHOUT
 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
 * FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more
 * details.
 */

package com.skali.cabdirectories.service.impl;

import java.util.ArrayList;
import java.util.HashMap;
import java.util.Iterator;
import java.util.List;

import javax.portlet.PortletConfig;
import javax.portlet.PortletURL;
import javax.portlet.RenderRequest;
import javax.portlet.RenderResponse;

import com.liferay.portal.kernel.dao.search.SearchContainer;
import com.liferay.portal.kernel.exception.SystemException;
import com.liferay.portal.kernel.language.LanguageUtil;
import com.liferay.portal.kernel.servlet.SessionErrors;
import com.liferay.portal.kernel.util.JavaConstants;
import com.liferay.portal.kernel.util.ListUtil;
import com.liferay.portal.kernel.util.ParamUtil;
import com.liferay.portal.kernel.util.WebKeys;
import com.liferay.portal.theme.ThemeDisplay;
import com.skali.cabdirectories.model.CABDirectories_Metadata;
import com.skali.cabdirectories.service.CABDirectories_MetadataLocalServiceUtil;
import com.skali.cabdirectories.service.base.CABDirectories_MetadataLocalServiceBaseImpl;

/**
 * The implementation of the c a b directories_ metadata local service.
 *
 * <p>
 * All custom service methods should be put in this class. Whenever methods are added, rerun ServiceBuilder to copy their definitions into the {@link com.skali.cabdirectories.service.CABDirectories_MetadataLocalService} interface.
 *
 * <p>
 * This is a local service. Methods of this service will not have security checks based on the propagated JAAS credentials because this service can only be accessed from within the same VM.
 * </p>
 *
 * @author Prabhakar
 * @see com.skali.cabdirectories.service.base.CABDirectories_MetadataLocalServiceBaseImpl
 * @see com.skali.cabdirectories.service.CABDirectories_MetadataLocalServiceUtil
 */
public class CABDirectories_MetadataLocalServiceImpl
	extends CABDirectories_MetadataLocalServiceBaseImpl {
	/*
	 * NOTE FOR DEVELOPERS:
	 *
	 * Never reference this interface directly. Always use {@link com.skali.cabdirectories.service.CABDirectories_MetadataLocalServiceUtil} to access the c a b directories_ metadata local service.
	 */
	/** This method returns the List<CABDirectories_Metadata> filtered on the following Params
	 * @param -HashMap...probably with the following keys--
	 * @HashMapkey - sammno
	 * @HashMapkey - - acbNo
	 * @HashMapkey -  - organizationName
	 * @HashMapkey -  - field
	 *  
	 */
	public List<CABDirectories_Metadata> fetchByCustomCabDirectories_MetadataFields(HashMap<String, Object> searchFieldsMap){
		
			List<CABDirectories_Metadata> cabDirectoriesMetadataList =  new ArrayList<CABDirectories_Metadata>();
			
			cabDirectoriesMetadataList = cabDirectories_MetadataFinder.fetchByCustomCabDirectories_MetadataFields(searchFieldsMap);
			
		return cabDirectoriesMetadataList;
		
	}
	
	


	 /**
	* @param renderRequest
	* @param renderResponse
	*/
	/*	public static void searchContainerData(RenderRequest renderRequest,RenderResponse renderResponse)
	{
		PortletConfig portletConfig = (PortletConfig)renderRequest.getAttribute(JavaConstants.JAVAX_PORTLET_CONFIG);
		ThemeDisplay themeDisplay = (ThemeDisplay)renderRequest.getAttribute(WebKeys.THEME_DISPLAY);
		List<CABDirectories_Metadata> cabDirectories_MetadataList = new ArrayList<CABDirectories_Metadata>();
	//	Map<String,String> paramMap= new HashMap<String,String>();
	//	paramMap.put("tabs", "UserGroup");
		*//**
		 * Creating IteratorURL and in that we will pass tab parameter
		 *//*
		
		PortletURL iteratorURL= renderResponse.createRenderURL();
		Iterator<Map.Entry<String, String>> entries = paramMap.entrySet().iterator();
		while (entries.hasNext()) {
			Map.Entry<String, String> entry = entries.next();
			iteratorURL.setParameter(entry.getKey(), entry.getValue());
		}
		
		*//**
		 * Creating SearchContainer
		 *//*
		SearchContainer<CABDirectories_Metadata> searchContainer = new SearchContainer<CABDirectories_Metadata>(renderRequest, null,
				null, SearchContainer.DEFAULT_CUR_PARAM, ParamUtil.getInteger(renderRequest, SearchContainer.DEFAULT_DELTA_PARAM, 5),
				iteratorURL, null, LanguageUtil.get(portletConfig, themeDisplay.getLocale(), "No CABDirectories were Found"));
		int total = 0;
		try {
			*//**
			 * Fetching all the User Group from the Current Company and added that into the userGroupList
			 *//*
			cabDirectories_MetadataList = CABDirectories_MetadataLocalServiceUtil.getCABDirectories_Metadatas(0, -1);
			total = cabDirectories_MetadataList.size();
		} catch (SystemException e) {
			SessionErrors.add(renderRequest, SystemException.class.getName());
			e.printStackTrace();
		}
		*//**
		 * Sub listing the userGroupList depending on the delta parameter we have set in the SearchContainer.
		 *//*
		cabDirectories_MetadataList = ListUtil.subList(cabDirectories_MetadataList, searchContainer.getStart(), searchContainer.getEnd());
		searchContainer.setTotal(total);
		searchContainer.setResults(cabDirectories_MetadataList);
		renderRequest.setAttribute("cabDirectoriesSearchContainer", searchContainer);
	}
*/
	
	
}